using System;
using System.Text;
using NLog;
using NLog.LayoutRenderers;

namespace HangfireLog.Model
{
    [LayoutRenderer("CustomException")]
    public class BizExceptionLayoutRenderer : ExceptionLayoutRenderer
    {
        protected override void Append(StringBuilder builder, LogEventInfo logEvent)
        {
            builder.Append("Append");
            // var bizException = logEvent.Exception as BizException;
            // if (bizException!=null)
            // {
            //     builder.Append($"业务异常：{bizException.BizMsg}");
            // }else
            // {
            //     base.Append(builder,logEvent);
            // }
        }
        protected override void AppendData(StringBuilder sb, Exception ex)
        {
            sb.Append("AppendData");
        }
        protected override void AppendToString(StringBuilder sb, Exception ex)
        {
            sb.Append("AppendToString");
            // if (ex is BizException)
            // {
            //     sb.Clear();
            //     sb.Append((ex as BizException).BizMsg);
            // }
        }
    }
}